package com.woniu.outlet.dao;


import java.util.List;

import com.woniu.outlet.po.WorkerPo;
import com.woniu.outlet.po.WorkerPoExample;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface WorkerPoMapper {
    long countByExample(WorkerPoExample example);

    int deleteByExample(WorkerPoExample example);

    int deleteByPrimaryKey(Long id);

    int insert(WorkerPo record);

    int insertSelective(WorkerPo record);

    List<WorkerPo> selectByExample(WorkerPoExample example);

    WorkerPo selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") WorkerPo record, @Param("example") WorkerPoExample example);

    int updateByExample(@Param("record") WorkerPo record, @Param("example") WorkerPoExample example);

    int updateByPrimaryKeySelective(WorkerPo record);

    int updateByPrimaryKey(WorkerPo record);

    @Select("select * from erp_system_management.ERP_worker where dept_id=1 and job=1")
    List<WorkerPo> getPruchaseWorker();

    @Select("select p.percode " +
            "from rbac_perms p inner join rbac_user_perm up on p.id=up.permid " +
            "inner join erp_system_management.ERP_worker u on u.id=up.userid " +
            "where u.account=#{username}")
    List<String> getPercodeByUsername(String username);
}